2017-02-17
Initial patch

2017-03-04
Additional information
2 pass encoding
  To apply two pass encoding use "2Pass" in the preset name.
  Example: <label>Asha 2Pass</label>

diff -3ur a/Sinthgunt/app.py b/Sinthgunt/app.py
--- a/Sinthgunt/app.py	2010-11-22 21:27:55.000000000 +0300
+++ b/Sinthgunt/app.py	2017-03-04 20:18:39.000000000 +0300
@@ -1,4 +1,5 @@
 #!/usr/bin/python
+# -*- coding: utf-8 -*-
 # $Id: app.py 196 2010-11-22 18:27:50Z kare1234 $
 
 ####################
@@ -35,17 +36,21 @@
 # Import Python Libraries
 ####################
 import os
+import errno
 import sys
 import pygtk; pygtk.require("2.0")
 import gtk.glade
 import subprocess
 import gobject
 import time
-import sys
-import urllib
 from xml.etree import ElementTree as etree
 
-
+def logfile_remove(self):
+    try:
+        os.remove(self)
+    except OSError as e: # this would be "except OSError, e:" before Python 2.6
+        if e.errno != errno.ENOENT: # errno.ENOENT = no such file or directory
+            raise # re-raise exception if a different error occurred
 
 def main():
     ####################
@@ -58,20 +63,22 @@
         print('It seems, that ffmpeg is not installed on this computer. \nSee http://www.sinthgunt.org for installation instructions.') # Display error message, then carry on
 
     # Define data and temp directories
-    DATA_DIR="/usr/share/sinthgunt/"
-    TEMP_DIR="/tmp/"
+    DATA_DIR = "/usr/share/sinthgunt/"
+    TEMP_DIR = "/tmp/"
     # Opens the log file and write the name and curent data and time
     logfile_filename = os.path.expanduser("~/.sinthgunt.log")
+    logfile_remove(logfile_filename)
     logfile = open(logfile_filename, 'a')
-    logfile.writelines('****** Sinthgunt log file START - '+
-            str(time.ctime())+' *******\n')
-    logo_filename=DATA_DIR+"logo.png"
+    logfile.writelines('\n******* Sinthgunt log file START - '+
+            str(time.ctime())+' *******\n\n')
+    logo_filename = DATA_DIR+"logo.png"
   
     # Carry over variables to class
     sinthgunt.logo_filename = logo_filename
     sinthgunt.DATA_DIR      = DATA_DIR
     sinthgunt.logfile       = logfile
     sinthgunt.TEMP_DIR      = TEMP_DIR
+    sinthgunt.function_activate = False
 
     # Run the main loop
     program = sinthgunt()
@@ -98,7 +105,7 @@
         # - 
         ####################
     
-    def ResetSinthgunt(self,widget):
+    def ResetSinthgunt(self, widget):
         ####################
         # Description
         # ===========
@@ -112,10 +119,10 @@
         #  
         ####################
         # Write default stuff to gui
-        self.labelGuide.set_text('Input file(s):')
+        self.labelGuide.set_text("Input file(s):")
         self.labelOperation.set_text('')
         context_id = self.statusbar.get_context_id("Activation")
-        self.statusbar.push(context_id,"Welcome to sinthgunt!")
+        self.statusbar.push(context_id, "Welcome to sinthgunt!")
         self.labelInput.set_text('')
         
         # Load the logo
@@ -143,8 +150,8 @@
         # Load XML config file
         self.parseXML()
         # Local variables
-        categorylist=self.categorylist  # List of categories
-        presetlist=self.presetlist      # List of presets in the categories
+        categorylist = self.categorylist  # List of categories
+        presetlist = self.presetlist      # List of presets in the categories
         # Connect to menu
         actionmenu = self.wTree.get_widget("menu2")
         # Constants
@@ -152,9 +159,10 @@
         self.Npreset = len(presetlist) # Number of presets
         counter = 0     # Counter that keeps track of the categories in the categorylist
         counter2 = 0    # Counter that keeps track of the codecs in the self.preset_enabled list
+        self.already_executed = False
 
         # Create first, dummy item in group. All later items are attached to this group
-        item = gtk.RadioMenuItem(group=None,label='') 
+        item = gtk.RadioMenuItem(group = None, label = '') 
         # Initialise presetmenuheaderholder, a holder for the submenues
         self.presetmenu1headerholder = []
         self.preset_enabled = []
@@ -170,32 +178,32 @@
                 if presetlist[i][0] == categorylist[counter]:
                     self.preset_enabled.append('')
                     # Create radio button for the preset
-                    item = gtk.RadioMenuItem(group=item,label=presetlist[i][1])
+                    item = gtk.RadioMenuItem(group = item, label = presetlist[i][1])
                     # What to do when the radiobutton is clicked
                     item.connect("activate", self.menuradiobuttonselect)
                     # Check to see if the codecs required by the preset are supported by the users version of ffmpeg
                     for requiredcodec in self.presetlist[i][4]:
-                            flag =0
+                            flag = 0
                             notfound = 1
                             for codec in self.codecs:
                                 # If encoding true
-                                if requiredcodec==codec[0] and codec[1]==True and flag==0: # preset will work                    
+                                if requiredcodec == codec[0] and codec[1] == True and flag == 0: # preset will work                    
                                     notfound = 0
-                                    self.preset_enabled[counter2]=True
+                                    self.preset_enabled[counter2] = True
                                 # if encoding false
-                                if requiredcodec==codec[0] and codec[1]==False:
+                                if requiredcodec == codec[0] and codec[1] == False:
                                     label =  item.get_children()[0]
                                     label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#888888')) # preset will not work - grayed out
                                     notfound = 0
-                                    flag=1
+                                    flag = 1
                                     item.set_tooltip_text('Your version of ffmpeg does not support this preset.')
-                                    self.preset_enabled[counter2]=False
+                                    self.preset_enabled[counter2] = False
                             # if codec was not found
-                            if notfound==1 and flag==0:
+                            if notfound == 1 and flag == 0:
                                     label =  item.get_children()[0]
                                     label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#888888')) # preset might work - grayed out
                                     item.set_tooltip_text('Your version of ffmpeg does not support this preset.')    
-                                    self.preset_enabled[counter2]=False
+                                    self.preset_enabled[counter2] = False
                     counter2 = counter2+1
                     # add item to the headerholder
                     self.presetmenu1headerholder[counter].append(item)
@@ -219,41 +227,39 @@
         # ===============
         # 
         ####################
-        context_id = self.statusbar.get_context_id("Activation")        
+        context_id = self.statusbar.get_context_id("Activation")      
         output = ''
         try:
             output_raw = str(self.process.stdout.read(80))
-            output = output_raw.replace('\n','')
+            output = output_raw.replace('=', ' ').replace('\r', '\n')
         except:
             pass
-        self.logfile.writelines('Conversion status: '+output+'\n')
+        self.logfile.writelines(output)
         output_split = output.split(' ')
-        N=len(output_split)
+        N = len(output_split)
         
         # get the number of frames converted
         for i in range(N):
-            if i>=2 and output_split[i]=='fps=':
-               file_frames_completed = output_split[i-1]              
-               self.logfile.writelines('Frames completed: '+file_frames_completed+'\n')
-               # update progressbar and statusbar
-               try:
-                   context_id = self.statusbar.get_context_id("Activation")  
-                   self.statusbar.push(context_id,'Frames converted: '+str(file_frames_completed))
-               except:
-                   pass
-               try:
-                   self.progressbar.set_fraction(float(\
-                           file_frames_completed)/float(self.file_frames))
-                   self.progressbar.set_text(str(file_frames_completed)+\
-                           ' of '+str(self.file_frames)+' frames converted.')
-               except:
-                   pass
+            if i >= 2 and output_split[i] == 'fps':
+                file_frames_completed = output_split[i-1]
+                # update progressbar and statusbar
+                try:
+                    context_id = self.statusbar.get_context_id("Activation")  
+                    self.statusbar.push(context_id, 'Frames converted: '+str(file_frames_completed))
+                except:
+                    pass
+                try:
+                    self.progressbar.set_fraction(float(\
+                            file_frames_completed)/float(self.file_frames))
+                    self.progressbar.set_text('Converting '+self.input[self.NextInputFileToConvert])
+                except:
+                    pass
 
         # Look for Classic errors. This should be done in a separate function sometime soon
         # "Must supply at least one output file"
         for i in range(N-1):
-            if i>=2 and output_split[i]=='Must=' and output_split[i+1]=='supply': # an error has occured
-                self.statusbar.push(context_id,'An error has occured. See the log file for details.')               
+            if i >= 2 and output_split[i] == 'Must=' and output_split[i+1] == 'supply': # an error has occured
+                self.statusbar.push(context_id, 'An error has occured. See the log file for details.')               
                 self.progressbar.set_fraction(0.0)
                 self.progressbar.set_text('')
                 return False 
@@ -261,24 +267,25 @@
 
 
         # if no output detected, stop watching the process and write to statusbar
-        if output =='':     
-            self.statusbar.push(context_id,'Conversion completed!')
-            self.progressbar.set_fraction(0.99999)
+        if output == '':     
+            self.statusbar.push(context_id, 'Conversion completed!')
+            self.progressbar.set_text('')
+            self.progressbar.set_fraction(1.0)
             # We are now done with the current file. Move on to next one if there are any left
             if self.NextInputFileToConvert <= len(self.input) - 2:
-                self.NextInputFileToConvert = self.NextInputFileToConvert + 1
+                self.NextInputFileToConvert = self.NextInputFileToConvert+1
                 self.activate(self.window)
             else:
-                self.NextInputFileToConvert = 0
+                #self.NextInputFileToConvert = 0
                 self.ResetSinthgunt(self.window)
-                self.statusbar.push(context_id,'Conversion completed!')
+                self.statusbar.push(context_id, 'Conversion completed!')
             return False    
         else:
             return True
   
     
     
-    def menuopenfile(self,widget):
+    def menuopenfile(self, widget):
         ####################
         # Description 
         # ===========
@@ -322,6 +329,8 @@
         filter.add_pattern("*.3G2")
         filter.add_pattern("*.mts")
         filter.add_pattern("*.MTS")
+        filter.add_pattern("*.mkv")
+        filter.add_pattern("*.MKV")
         fc.add_filter(filter)
         # all files       
         filter = gtk.FileFilter()
@@ -357,7 +366,7 @@
         #
         ####################
         # generate thumbnail from input file
-        self.thumbnail_filename=self.generateThumbnail(self.input[-1])
+        self.thumbnail_filename = self.generateThumbnail(self.input[-1])
         
         # update thumbnail
         try:
@@ -369,20 +378,23 @@
         
         # fill label with file info
         self.labelInput.set_text('')
-        self.labelInput.set_text('Codec info for '+self.input[-1]+'\n\n'\
-                                'Audio codec: '+str(self.audio_codec[0])+'\n'\
-                                'Audio bitrate: '+str(self.audio_codec[4])+' kb/s\n'\
-                                +'Video codec: '+ str(self.video_codec[0])\
-                                +'\nVideo resolution: '+ str(self.video_codec[2])\
-                                +'\nVideo bitrate: '+ str(self.video_codec[3])\
-                                +'\n'+'Number of frames: '+str(self.file_frames))
-        self.ListOfInputFiles='\n'
+        self.labelInput.set_text(' Codec info for\n '+self.input[-1]+'\n\n'\
+                                ' Audio codec: '+str(self.audio_codec[0])+\
+                                ', '+str(self.audio_codec[1])+\
+                                ', '+str(self.audio_codec[2])+'\n'\
+                                ' Video codec: '+str(self.video_codec[0])+\
+                                ', '+str(self.video_codec[1])+\
+                                ', '+str(self.video_codec[2])+\
+                                ', '+str(self.video_codec[3])+'\n'\
+                                ' Bitrate: '+str(self.bitrate_info[0])+'\n'
+                                ' Number of frames: '+str(self.file_frames)+'\n')
+        self.ListOfInputFiles = '\n'
         for i in range(len(self.input)):
-            StringToAdd=str(i+1)+'. '+self.input[i]+'\n'
-            self.ListOfInputFiles=self.ListOfInputFiles+StringToAdd
+            StringToAdd = str(i+1)+'. '+self.input[i]+'\n'
+            self.ListOfInputFiles = self.ListOfInputFiles+StringToAdd
         self.labelGuide.set_text('Input file(s): '+self.ListOfInputFiles)
 
-    def RemoveInputFile(self,widget):
+    def RemoveInputFile(self, widget):
         ####################
         # Description
         # ===========
@@ -398,7 +410,7 @@
         #
         ####################      
         #base this on a message dialog  
-        dialog = gtk.MessageDialog(None,gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,gtk.MESSAGE_QUESTION,gtk.BUTTONS_OK_CANCEL,None)  
+        dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL, None)  
         dialog.set_markup('Enter the number of the input file you wish to remove')  
         #create the text input field  
         entry = gtk.Entry()  
@@ -414,18 +426,17 @@
         dialog.vbox.pack_end(hbox, True, True, 0)  
         dialog.show_all()  
         #go go go  
-        Response=dialog.run()  
+        Response = dialog.run()  
         if Response == gtk.RESPONSE_OK: 
             try:        
                 InputFileToRemove = int(entry.get_text())-1
-                 # Clear everything if we are removing the last tile
+                # Clear everything if we are removing the last tile
                 if len(self.input) >= 2:
                     del self.input[InputFileToRemove]
                     self.setinput(widget)
                     self.NextInputFileToConvert = 0
                 else:
                     self.ResetSinthgunt(widget)
-                    self.ResetSinthgunt(widget)
             except:
                 pass
 
@@ -447,25 +458,21 @@
         # This function uses ffmpeg to generate a thumbnail.
         ####################
 
-        # get file base name
-        temp = videoFile.split('/')
-        N = len(temp)        
-        videoFileBaseName = temp[N-1]
-        # set thumbnail filename
-        thumbnailFileName = sinthgunt.TEMP_DIR+str(videoFileBaseName)+".jpg"
+        thumbnailFileName = sinthgunt.TEMP_DIR+"videothumbnail.jpg"
+        logfile_remove(thumbnailFileName)
 
         # ffmpeg command line
-        subcommand = ['ffmpeg', '-y', '-itsoffset', '-5' ,'-i' ,videoFile,\
-                "-vcodec","mjpeg","-vframes", "1", "-an", "-f", "rawvideo", "-s", "170x128",\
-                thumbnailFileName]
+        subcommand = ['ffmpeg', '-v', 'warning', '-y', '-itsoffset', '-5', '-i', videoFile, \
+                '-vcodec', 'mjpeg', '-vframes', '1', '-an', '-f', 'rawvideo', '-s', '172x129', \
+                '-vf', 'crop=4/3*in_h:in_h', '-filter', 'format=rgb24', thumbnailFileName]
     
-        thumbProcess = subprocess.Popen(args=subcommand,
-                            stdout=subprocess.PIPE,stdin=subprocess.PIPE,
-                            stderr=subprocess.STDOUT,shell=False)
+        thumbProcess = subprocess.Popen(args = subcommand,
+                            stdout = subprocess.PIPE, stdin = subprocess.PIPE,
+                            stderr = subprocess.STDOUT, shell = False)
 
         # Read output from thumbnail process and write it to the log file
-        output = str(thumbProcess.stdout.read(100))
-        self.logfile.writelines('Thumbnail process status: '+output+'\n')
+        output = str(thumbProcess.stdout.read(300))
+        self.logfile.writelines('\n\nThumbnail process status:\n'+output+'\n')
 
         # Wait for thumbnail process to complete
         thumbProcess.wait()
@@ -474,7 +481,7 @@
         return thumbnailFileName
      
      
-    def generatePreview(self,widget):
+    def generatePreview(self, widget):
         ####################
         # Description
         # ===========
@@ -495,17 +502,64 @@
         try:
             operation = self.operation_radiobutton
             context_id = self.statusbar.get_context_id("Activation")  
-            self.statusbar.push(context_id,'Creating preview of '+self.input[-1]+'. You can view it using the Play menu.')
+            self.statusbar.push(context_id, 'Creating preview of '+self.input[-1]+'. You can view it using the Play menu.')
         
             #for now, operate on last input file
-            InputFileName=self.input[-1]
+            InputFileName = self.input[-1]
+
             for i in range(self.Npreset):
-                if operation == self.presetlist[i][1]:
+                if operation == self.presetlist[i][1] and '2Pass' in self.presetlist[i][1]:
                     # generate command line in subprocess syntax
-                    subcommand = ['/usr/bin/ffmpeg','-y','-i']
+                    subcommand = ['/usr/bin/ffmpeg', '-v', 'warning', '-y', '-i']
                     subcommand.extend([InputFileName])
-                    subcommand.extend(['-t','5'])
-                    temp1=self.presetlist[i][2].split(' ')
+                    subcommand.extend(['-t', '5', '-an', '-pass', '1', '-passlogfile', '/tmp/twopass'])
+                    temp1 = self.presetlist[i][2].split(' ')
+                    # remove empty entries ('') from the array
+                    for ii in range(20):
+                        try:
+                            temp1.remove('')
+                        except:
+                            pass
+                    temp1.extend(['/dev/null'])
+                    subcommand.extend(temp1)
+                    # Start converting
+                    first_pass_process = subprocess.Popen(args = subcommand,
+                            stdout = subprocess.PIPE, stdin = subprocess.PIPE,
+                            stderr = subprocess.STDOUT, shell = False)
+                    
+                    self.logfile.writelines('\nConversion command:\n'+str(subcommand)+'\n')
+                    
+                    first_pass_process.wait()
+                    
+                    # generate command line in subprocess syntax
+                    subcommand = ['/usr/bin/ffmpeg', '-v', 'warning', '-y', '-i']
+                    subcommand.extend([InputFileName])
+                    subcommand.extend(['-t', '5', '-pass', '2', '-passlogfile', '/tmp/twopass'])
+                    temp1 = self.presetlist[i][2].split(' ')
+                    # remove empty entries ('') from the array
+                    for ii in range(20):
+                        try:
+                            temp1.remove('')
+                        except:
+                            pass
+                    temp1.extend([str(InputFileName+"_preview_twopass."+self.presetlist[i][3])])
+                    # path to output file
+                    self.output = str(InputFileName+"_preview_twopass."+self.presetlist[i][3])
+                    subcommand.extend(temp1)
+                    # Start converting
+                    second_pass_process = subprocess.Popen(args = subcommand,
+                            stdout = subprocess.PIPE, stdin = subprocess.PIPE,
+                            stderr = subprocess.STDOUT, shell = False)
+                    
+                    self.logfile.writelines('\n'+str(subcommand)+'\n')
+                    
+                    second_pass_process.wait()
+                    
+                if operation == self.presetlist[i][1] and '2Pass' not in self.presetlist[i][1]:
+                    subcommand = ['/usr/bin/ffmpeg', '-v', 'warning', '-y', '-i']
+                    subcommand.extend([InputFileName])
+                    subcommand.extend(['-t', '5'])
+                    temp1 = self.presetlist[i][2].split(' ')
                     # remove empty entries ('') from the array
                     for ii in range(20):
                         try:
@@ -514,19 +568,21 @@
                             pass
                     temp1.extend([str(InputFileName+"_preview."+self.presetlist[i][3])])
                     # path to output file
-                    self.output=str(InputFileName+"_preview."+self.presetlist[i][3])
+                    self.output = str(InputFileName+"_preview."+self.presetlist[i][3])
                     subcommand.extend(temp1)
                     # Start converting
-                    self.process = subprocess.Popen(args=subcommand,
-                            stdout=subprocess.PIPE,stdin=subprocess.PIPE,
-                            stderr=subprocess.STDOUT,shell=False)
+                    converting_process = subprocess.Popen(args = subcommand,
+                            stdout = subprocess.PIPE, stdin = subprocess.PIPE,
+                            stderr = subprocess.STDOUT, shell = False)
+                    
+                    self.logfile.writelines('\nConversion command:\n'+str(subcommand)+'\n')
                     
-                    self.logfile.writelines('Conversion command: '+str(subcommand)+'\n')
+                    converting_process.wait()
         except:
             self.no_file_selected_dialog(widget)
 
 
-    def BeginConversion(self,widget,InputFileIndex):
+    def BeginConversion(self, widget, InputFileIndex):
         ####################
         # Description
         # ===========
@@ -542,7 +598,7 @@
         ####################      
       
        
-    def activate(self,widget):
+    def activate(self, widget):
         ####################
         # Description
         # ===========
@@ -556,24 +612,96 @@
         # ===============
         #
         ####################
+        
+        self.function_activate = True
 
         # Get selected operation from menu
        
         try:
             operation = self.operation_radiobutton
-            self.progressbar.set_fraction(0.01)
-            context_id = self.statusbar.get_context_id("Activation")  
-            self.statusbar.push(context_id,'Converting '+self.input[self.NextInputFileToConvert])
+            InputFileName = self.input[self.NextInputFileToConvert]
+            # generate thumbnail from input file
+            self.thumbnail_filename = self.generateThumbnail(InputFileName)
         
-            #start watching output
-            self.source_id = gobject.timeout_add(500, self.checkfile)
-            InputFileName=self.input[self.NextInputFileToConvert]
+            # update thumbnail
+            try:
+                self.thumbnail.set_from_file(self.thumbnail_filename)
+            except:
+                pass
+            # get media file info
+            mediaFileInformation = self.file_getinfo()
+        
+            # fill label with file info
+            self.labelInput.set_text('')
+            self.labelInput.set_text(' Codec info for\n '+InputFileName+'\n\n'\
+                                ' Audio codec: '+str(self.audio_codec[0])+\
+                                ', '+str(self.audio_codec[1])+\
+                                ', '+str(self.audio_codec[2])+'\n'\
+                                ' Video codec: '+str(self.video_codec[0])+\
+                                ', '+str(self.video_codec[1])+\
+                                ', '+str(self.video_codec[2])+\
+                                ', '+str(self.video_codec[3])+'\n'\
+                                ' Bitrate: '+str(self.bitrate_info[0])+'\n'
+                                ' Number of frames: '+str(self.file_frames)+'\n')
+            
             for i in range(self.Npreset):
-                if operation == self.presetlist[i][1]:
+                
+                if operation == self.presetlist[i][1] and '2Pass' in self.presetlist[i][1]:
+                    # generate command line in subprocess syntax
+                    subcommand = ['/usr/bin/ffmpeg', '-v', 'warning', '-y', '-i']
+                    subcommand.extend([InputFileName])
+                    subcommand.extend(['-an', '-pass', '1', '-passlogfile', '/tmp/twopass'])
+                    temp1 = self.presetlist[i][2].split(' ')
+                    # remove empty entries ('') from the array
+                    for ii in range(20):
+                        try:
+                            temp1.remove('')
+                        except:
+                            pass
+                    temp1.extend(['/dev/null'])
+                    subcommand.extend(temp1)
+                    # Start converting
+                    first_pass_process = subprocess.Popen(args = subcommand,
+                            stdout = subprocess.PIPE, stdin = subprocess.PIPE,
+                            stderr = subprocess.STDOUT, shell = False)
+                    
+                    self.logfile.writelines('\nConversion command:\n'+str(subcommand)+'\n')
+                    
+                    first_pass_process.wait()
+                    
+                    # generate command line in subprocess syntax
+                    subcommand = ['/usr/bin/ffmpeg', '-v', 'warning', '-stats', '-y', '-i']
+                    subcommand.extend([InputFileName])
+                    subcommand.extend(['-pass', '2', '-passlogfile', '/tmp/twopass'])
+                    temp1 = self.presetlist[i][2].split(' ')
+                    # remove empty entries ('') from the array
+                    for ii in range(20):
+                        try:
+                            temp1.remove('')
+                        except:
+                            pass
+                    temp1.extend([str(InputFileName+"_twopass."+self.presetlist[i][3])])
+                    # path to output file
+                    self.output = str(InputFileName+"_twopass."+self.presetlist[i][3])
+                    subcommand.extend(temp1)
+                    # Start converting
+                    self.process = subprocess.Popen(args = subcommand,
+                            stdout = subprocess.PIPE, stdin = subprocess.PIPE,
+                            stderr = subprocess.STDOUT, shell = False)
+                    
+                    self.logfile.writelines('\n'+str(subcommand)+'\n\n')
+                    self.progressbar.set_fraction(0.0)
+                    context_id = self.statusbar.get_context_id("Activation")  
+                    self.statusbar.push(context_id, 'Converting '+self.input[self.NextInputFileToConvert]+' (second pass)')
+                    #start watching output
+                    self.source_id = gobject.timeout_add(500, self.checkfile)
+                    self.function_activate = False
+                
+                if operation == self.presetlist[i][1] and '2Pass' not in self.presetlist[i][1]:
                     # generate command line in subprocess syntax
-                    subcommand = ['/usr/bin/ffmpeg','-y','-i']
+                    subcommand = ['/usr/bin/ffmpeg', '-v', 'warning', '-stats', '-y', '-i']
                     subcommand.extend([InputFileName])
-                    temp1=self.presetlist[i][2].split(' ')
+                    temp1 = self.presetlist[i][2].split(' ')
                     # remove empty entries ('') from the array
                     for ii in range(20):
                         try:
@@ -582,19 +710,25 @@
                             pass
                     temp1.extend([str(InputFileName+"."+self.presetlist[i][3])])
                     # path to output file
-                    self.output=str(InputFileName+"."+self.presetlist[i][3])
+                    self.output = str(InputFileName+"."+self.presetlist[i][3])
                     subcommand.extend(temp1)
                     # Start converting
-                    self.process = subprocess.Popen(args=subcommand,
-                            stdout=subprocess.PIPE,stdin=subprocess.PIPE,
-                            stderr=subprocess.STDOUT,shell=False)
+                    self.process = subprocess.Popen(args = subcommand,
+                            stdout = subprocess.PIPE, stdin = subprocess.PIPE,
+                            stderr = subprocess.STDOUT, shell = False)
                     
-                    self.logfile.writelines('Conversion command: '+str(subcommand)+'\n')
+                    self.logfile.writelines('\nConversion command:\n'+str(subcommand)+'\n\n')
+                    self.progressbar.set_fraction(0.0)
+                    context_id = self.statusbar.get_context_id("Activation")  
+                    self.statusbar.push(context_id, 'Converting '+self.input[self.NextInputFileToConvert])
+                    #start watching output
+                    self.source_id = gobject.timeout_add(500, self.checkfile)
+                    self.function_activate = False
         except:
             self.no_file_selected_dialog(widget)
 
 
-    def stop(self,widget):
+    def stop(self, widget):
         ####################
         # Description
         # ===========
@@ -608,19 +742,19 @@
         #
         ####################
         try:
-            os.kill(self.process.pid,9)
+            os.kill(self.process.pid, 9)
             gobject.source_remove(self.source_id)
             self.progressbar.set_fraction(0.0)
             self.progressbar.set_text('')
-            self.logfile.writelines('Conversion aborted by user\n')
+            self.logfile.writelines('\nConversion aborted by user\n')
             context_id = self.statusbar.get_context_id("Activation")  
-            self.statusbar.push(context_id,'Conversion aborted!')
+            self.statusbar.push(context_id, 'Conversion aborted!')
         except:
             pass
             
    
 
-    def quit_program(self,widget):
+    def quit_program(self, widget):
         ####################
         # Description
         # ===========
@@ -634,7 +768,7 @@
         #
         ####################
         self.stop
-        self.logfile.writelines('****** Sinthgunt log file STOP - '+str(time.ctime())+' *******\n')
+        self.logfile.writelines('\n******* Sinthgunt log file STOP - '+str(time.ctime())+' *******\n\n')
         self.logfile.close
         gtk.main_quit()
 
@@ -653,17 +787,21 @@
         # ===============
         #
         ####################
-        self.audio_codec = ['N/A','N/A','N/A','N/A','N/A']
-        self.video_codec = ['N/A','N/A','N/A','N/A','N/A']
+        self.audio_codec = ['N/A', 'N/A', 'N/A']
+        self.video_codec = ['N/A', 'N/A', 'N/A', 'N/A']
+        self.bitrate_info = ['N/A']
         self.file_frames = 0
-        InputFileName=self.input[-1]
-        command = ["ffmpeg","-i",InputFileName]
+        if self.function_activate == True:
+            InputFileName = self.input[self.NextInputFileToConvert]
+        else:
+            InputFileName = self.input[-1]
+        command = ['ffmpeg', '-i', InputFileName]
 
-        process = subprocess.Popen(args=command,stdout=subprocess.PIPE,
-                stdin=subprocess.PIPE,stderr=subprocess.STDOUT)
+        process = subprocess.Popen(args = command, stdout = subprocess.PIPE,
+                stdin = subprocess.PIPE, stderr = subprocess.STDOUT)
 
         flag = 1
-        counter=0
+        counter = 0
         try:
             while flag == 1:   
                 try:       
@@ -672,49 +810,66 @@
                     break
 
                 if output != '\n' and output != '':
-                    self.logfile.writelines('Get file info status: '+output+'\n')
+                    self.logfile.writelines('\nGet file info status:\n'+output+'\n')
                     output_split = output.split(' ')
-                    N=len(output_split)
+                    N = len(output_split)
                     for i in range(N):
     
                         # Find length of audio/video file in seconds            
-                        if output_split[i]=='Duration:':
-                            file_length_min=output_split[i+1]
-                            file_length_min_split=file_length_min.split(':')
+                        if output_split[i] == 'Duration:':
+                            file_length_min = output_split[i+1]
+                            file_length_min_split = file_length_min.split(':')
                             temp = file_length_min_split[2].split('.')
-                            file_length_min_split[2]=temp[0]
+                            file_length_min_split[2] = temp[0]
                             # Calculate length of file in seconds               
-                            file_length_sec=3600*float(file_length_min_split[0])+\
+                            file_length_sec = 3600*float(file_length_min_split[0])+\
                                     60*float(file_length_min_split[1])+\
                                     float(file_length_min_split[2])
+
+                        # Find video bitrate            
+                        if output_split[i] == 'bitrate:':
+                            self.bitrate_info[0] = output_split[i+1].strip(',')+' kb/s'
                 
                         # Find video codec            
-                        if output_split[i]=='Video:':
+                        if output_split[i] == 'Video:':
                             self.video_codec[0] = output_split[i+1].strip(',')
-                            self.video_codec[1] = output_split[i+2].strip(',')
-                            self.video_codec[2] = output_split[i+3].strip(',')
-
-                        # Find video bitrate            
-                        if output_split[i]=='bitrate:':
-                            self.video_codec[3] = output_split[i+1].strip(',')+' kb/s'
+                            
+                        if i >= 2 and (output_split[i] == 'yuv420p,'):
+                            self.video_codec[1] = output_split[i+1].strip(',')
+                        elif i >= 2 and (output_split[i] == 'rgb24,'):
+                            self.video_codec[1] = output_split[i+1].strip(',')
+                        elif i >= 2 and (output_split[i] == 'yuv444p,'):
+                            self.video_codec[1] = output_split[i+1].strip(',')
+                        elif i >= 2 and (output_split[i] == 'yuv420p(tv),'):
+                            self.video_codec[1] = output_split[i+1].strip(',')
+                            
+                        if i >= 2 and (output_split[i] == 'kb/s,'):
+                            self.video_codec[2] = output_split[i-1]+' kb/s'
+                            
+                        if i >= 2 and (output_split[i] == 'fps,'):
+                            self.video_codec[3] = output_split[i-1]+' fps'
 
                         # Find frames pr. second in the file 
-                        if i>=2 and (output_split[i]=='tb(r)\n' or output_split[i]=='tb(r)\nMust' or output_split[i]=='tbr,'):
-                            file_fps=output_split[i-1]
+                        if i >= 2 and (output_split[i] == 'tb(r)\n' or output_split[i] == 'tb(r)\nMust' or output_split[i] == 'tbr,'):
+                            file_fps = output_split[i-1]
                             # Calculate total number of frames
                             self.file_frames = int(file_length_sec*float(file_fps))
                 
                         # Find audio codec
-                        if output_split[i]=='Audio:':
-                            self.audio_codec = [output_split[i+1].strip(','),
-                                output_split[i+2].strip(','),
-                                output_split[i+3].strip(','),
-                                output_split[i+4].strip(','),
-                                output_split[i+5]]
-                            #flag = 0  
+                        if output_split[i] == 'Audio:':
+                            self.audio_codec[0] = output_split[i+1].strip(',')
+                            
+                        if i >= 2 and (output_split[i] == 'Hz,'):
+                            self.audio_codec[1] = output_split[i-1]+' Hz'
+                            
+                        if i >= 2 and (output_split[i] == 'fltp,'):
+                            self.audio_codec[2] = output_split[i+1]+' kb/s'
+                        elif i >= 2 and (output_split[i] == 's16p,'):
+                            self.audio_codec[2] = output_split[i+1]+' kb/s'
+                        
                 
                 # Stop if we reach the end of ffmpeg's output
-                if counter >= 1000 or output_spilt[i]=='file\n':
+                if counter >= 1000 or output_split[i] == 'file\n':
                     flag = 0
                 counter = counter+1
         except:
@@ -723,7 +878,7 @@
         self.logfile.writelines('Video codec: '+str(self.video_codec)+'\n')
         self.logfile.writelines('Number of frames: '+str(self.file_frames)+'\n')
 
-    def aboutdialog(self,widget):
+    def aboutdialog(self, widget):
         ####################
         # Description
         # ===========
@@ -746,9 +901,9 @@
                         \nConvert button in the main window.\
                         \n\nPlease visit http://www.sinthgunt.org\
                         \nfor more info."
-        self.InformationDialog(widget,dialogtext)
+        self.InformationDialog(widget, dialogtext)
 
-    def no_file_selected_dialog(self,widget):
+    def no_file_selected_dialog(self, widget):
         ####################
         # Description
         # ===========
@@ -761,11 +916,11 @@
         # ===============
         #
         #################### 
-        dialogtext = "You have to select a file and/or a preset before you \
+        dialogtext = "\n  You have to select a file and/or a preset before you \
         \ncan begin converting!"
-        self.ErrorDialog(widget,dialogtext)
+        self.ErrorDialog(widget, dialogtext)
 
-    def unsupported_codec_dialog(self,widget):
+    def unsupported_codec_dialog(self, widget):
         ####################
         # Description
         # ===========
@@ -778,13 +933,13 @@
         # ===============
         #
         #################### 
-        dialogtext = "You have selected a preset which is (probably) not supported by your version of ffmpeg. \
+        dialogtext = "  You have selected a preset which is (probably) not supported by your version of ffmpeg. \
 To upgrade ffmpeg, please check your distribution documentation. \
-\n If you want, you may disregard this warning and check the log file (sinthgunt.log) \
-after pressing the convert button"
-        self.ErrorDialog(widget,dialogtext)
+\n  If you want, you may disregard this warning and check the log file (~/.sinthgunt.log) \
+after pressing the convert button."
+        self.ErrorDialog(widget, dialogtext)
     
-    def ErrorDialog(self,widget,dialogtext):
+    def ErrorDialog(self, widget, dialogtext):
         ####################
         # Description
         # ===========
@@ -802,10 +957,10 @@
                 gtk.BUTTONS_NONE, dialogtext)
         message.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
         resp = message.run()
-        if resp == gtk.RESPONSE_CLOSE:
+        if resp == gtk.RESPONSE_CLOSE or gtk.STOCK_CLOSE:
             message.destroy()
 
-    def InformationDialog(self,widget,dialogtext):
+    def InformationDialog(self, widget, dialogtext):
         ####################
         # Description
         # ===========
@@ -821,13 +976,13 @@
         message = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_NONE, dialogtext)
         message.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
         resp = message.run()
-        if resp == gtk.RESPONSE_CLOSE:
+        if resp == gtk.RESPONSE_CLOSE or gtk.STOCK_CLOSE:
             message.destroy()
 
 
 
 
-    def menuradiobuttonselect(self,widget):
+    def menuradiobuttonselect(self, widget):
         ####################
         # Description
         # ===========
@@ -840,18 +995,22 @@
         #
         #################### 
         self.operation_radiobutton = ''
-        counter=0
+        counter = 0
         for presetmenu1header in self.presetmenu1headerholder:
             for item in presetmenu1header:
                 if item.get_active() == True:
                     self.operation_radiobutton = self.presetlist[counter][1]
-                    self.labelOperation.set_text('Output to '+self.presetlist[counter][1])
+                    self.labelOperation.set_text('Output to '+self.presetlist[counter][1]+' ')
                     # if preset is not supported, display unsupported_codec_dialog                    
-                    if self.preset_enabled[counter]==False:
+                    if self.preset_enabled[counter] == False and self.already_executed == False:
                         self.unsupported_codec_dialog(widget)
-                        self.labelOperation.set_text('Output to '+self.presetlist[counter][1]+'\n(Preset not supported by ffmpeg)')
+                        self.labelOperation.set_text('Output to '+self.presetlist[counter][1]+' (preset not supported) ')
+                        #item.set_active(True)
+                        self.already_executed = True
+                    elif self.preset_enabled[counter] == False and self.already_executed == True:
+                        self.labelOperation.set_text('Output to '+self.presetlist[counter][1]+' (preset not supported) ')
                         #item.set_active(True)
-                counter = counter + 1
+                counter = counter+1
                 
 
     def parseXML(self):
@@ -877,48 +1036,48 @@
         xml_file = os.path.dirname(xml_file) # load xml file
         xml_file = os.path.join(xml_file, self.DATA_DIR+"presets.xml")
         optionsXML = etree.parse(xml_file)
-        presets=[]
-        row = [' ',' ',' ',' ',[]]
+        presets = []
+        row = [' ', ' ', ' ', ' ', []]
 
-	    # Iterate through presets in xml file
+        # Iterate through presets in xml file
         for child in optionsXML.getiterator():
             if child.tag == 'label': # preset name
-                row[1]=child.text
+                row[1] = child.text
 
             if child.tag == 'params': # preset ffmpeg command line options
-                row[2]=child.text
+                row[2] = child.text
 
             if child.tag == 'extension': # output file extension
-                row[3]=child.text.strip(' ')
+                row[3] = child.text.strip(' ')
 
             if child.tag == 'category': # preset category
-                row[0]=child.text
+                row[0] = child.text
 
             if child.tag == 'codecs': # encoding codecs required by preset
-                row[4]=child.text.split(',')
+                row[4] = child.text.split(',')
                 presets.append(row)
-                row = [' ',' ',' ',' ',[]]
+                row = [' ', ' ', ' ', ' ', []]
                 # (planned): Test if codec will work
 
             
-    	# Sort by category name
-    	presets.sort(lambda x, y: cmp(x[0],y[0]))
+        # Sort by category name
+        presets.sort(lambda x, y: cmp(x[0], y[0]))
 
-    	# find category list
-    	categories=[presets[0][0]]
-    	for row in presets:
-        	if row[0]!=categories[-1]:
-            		categories.append(row[0])
+        # find category list
+        categories = [presets[0][0]]
+        for row in presets:
+            if row[0] != categories[-1]:
+                    categories.append(row[0])
 
         # make lists global        
-        self.presetlist=presets
-        self.categorylist=categories
+        self.presetlist = presets
+        self.categorylist = categories
 
         # Get codecs and check if encoding and/or decoding is avaliable
         self.ffmpeg_getcodecs()
 
 
-    def ffmpeg_getinfo(self,widget):
+    def ffmpeg_getinfo(self, widget):
         ####################
         # Description
         # ===========
@@ -936,16 +1095,16 @@
         #
         ####################
         self.ffmpeg_getcodecs()
-        command = ["ffmpeg","-version"]
+        command = ['ffmpeg', '-version']
         output = ''
         try:
-            process = subprocess.Popen(args=command,stdout=subprocess.PIPE,
-                    stdin=subprocess.PIPE,stderr=subprocess.STDOUT)
+            process = subprocess.Popen(args = command, stdout = subprocess.PIPE,
+                    stdin = subprocess.PIPE, stderr = subprocess.STDOUT)
             output = str(process.stdout.read(10000))        
         except:
             None
-        dialogtext=output
-        self.InformationDialog(widget,dialogtext)
+        dialogtext = output
+        self.InformationDialog(widget, dialogtext)
         
     def ffmpeg_getcodecs(self):
         ####################
@@ -960,224 +1119,73 @@
         # ===============
         #
         #################### 
-        command = ["ffmpeg","-formats"]
+        command = ['ffmpeg', '-v', 'warning', '-formats']
         output = ''
 
         try:
-            process = subprocess.Popen(args=command,stdout=subprocess.PIPE,
-                    stdin=subprocess.PIPE,stderr=subprocess.STDOUT)
+            process = subprocess.Popen(args = command, stdout = subprocess.PIPE,
+                    stdin = subprocess.PIPE, stderr = subprocess.STDOUT)
             output = str(process.stdout.read(20000))        
         except:
             None
-        #self.logfile.writelines('ffmpeg_getformats output: '+str(output))
 
-        command = ["ffmpeg","-codecs"]
+        command = ['ffmpeg', '-v', 'warning', '-codecs']
 
         try:
-            process = subprocess.Popen(args=command,stdout=subprocess.PIPE,
-                    stdin=subprocess.PIPE,stderr=subprocess.STDOUT)
+            process = subprocess.Popen(args = command, stdout = subprocess.PIPE,
+                    stdin = subprocess.PIPE, stderr = subprocess.STDOUT)
             output += str(process.stdout.read(20000))        
         except:
             None
-        self.logfile.writelines('ffmpeg_getcodecs output: '+str(output))
+        self.logfile.writelines('\nCodecs output:\n'+str(output)+'\n')
 
-        output_lines=output.split('\n')
-        codecs_raw=[]
-        Ncodecs=0
+        output_lines = output.split('\n')
+        codecs_raw = []
+        Ncodecs = 0
         for line in output_lines:
-            line_split=line.split(' ')
-            line_codec=line_split[0:7]
+            line_split = line.split(' ')
+            line_codec = line_split[0:7]
             for i in range(20):
                 try:
                     line_codec.remove('')
                 except:
                     pass
             codecs_raw.append(line_codec)
-            Ncodecs=Ncodecs+1
-        self.logfile.writelines('ffmpeg_getcodecs codecs_raw: '+str(codecs_raw))
+            Ncodecs = Ncodecs+1
+        self.logfile.writelines('\nRaw codecs:\n'+str(codecs_raw)+'\n')
         # look for encoding 
-        self.codecs=[]
+        self.codecs = []
         for i in range(Ncodecs):
-                flag = 0
+                flagA = 0
+                flagB = 0
                 try:
                     # row: codec name, encode, decode
-                    row = ['',False,False]
+                    row = ['', False, False]
                     # Check to see if we can encode
-                    if codecs_raw[i][0].find('E')== 0 or codecs_raw[i][0].find('E')== 1:
-                        row[0]=codecs_raw[i][-1]  
-                        row[1]=True
-                        flag = 1
+                    if codecs_raw[i][0].find('E') == 0 or codecs_raw[i][0].find('E') == 1:
+                        row[0] = codecs_raw[i][-1]  
+                        row[1] = True
+                        flagA = 1
                     # Check to see if we can decode
-                    if codecs_raw[i][0].find('D')== 0 or codecs_raw[i][0].find('D')== 1:
-                        row[0]=codecs_raw[i][-1]
-                        row[2]=True
-                        flag =1
+                    if codecs_raw[i][0].find('D') == 0 or codecs_raw[i][0].find('D') == 1:
+                        row[0] = codecs_raw[i][-1]
+                        row[2] = True
+                        flagB = 1
                     # Only add codec if we can either encode or decode
-                    if flag==1:
+                    if flagA and flagB == 1:
                         self.codecs.append(row)                       
                 except:     
                     pass
         # Debugging codec row
-        row = ['debugcodec',True,True]
+        row = ['debugcodec', True, True]
         self.codecs.append(row)  
-        self.logfile.writelines('ffmpeg_getcodecs self.codecs: '+str(self.codecs))
- 
-
-#####################
-## YouTube functions
-#####################
-    def menuopenyoutube(self,widget):  
-        ####################
-        # Description
-        # ===========
-        """ Dialog that allows the user to enter a YouTube url. 
-            Once the user presses the 'ok' button, the download will begin"""
-        # Arguments
-        # =========
-        #
-        # Further Details
-        # ===============
-        #
-        ####################      
-        #base this on a message dialog  
-        dialog = gtk.MessageDialog(None,gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,gtk.MESSAGE_QUESTION,gtk.BUTTONS_OK_CANCEL,None)  
-        dialog.set_markup('Please enter a link to a video file, eg.')  
-        #create the text input field  
-        entry = gtk.Entry()  
-        #allow the user to press enter to do ok  
-        #entry.connect("activate", dialog.response(response), dialog, gtk.RESPONSE_OK)  
-        #create a horizontal box to pack the entry and a label  
-        hbox = gtk.HBox()  
-        hbox.pack_start(gtk.Label("URL:"), False, 5, 5)  
-        hbox.pack_end(entry)  
-        #some secondary text  
-        dialog.format_secondary_markup("<i>http://www.youtube.com/watch?v=LkCNJRfSZBU</i>\n\n\
-Sinthgunt supports YouTube, Metacafe, Google Video, Photobucket and Yahoo! Video.")  
-        #add it and show it  
-        dialog.vbox.pack_end(hbox, True, True, 0)  
-        dialog.show_all()  
-        # Start dialog. 
-        Response = dialog.run()  
-        self.youtubeurl = entry.get_text()  
-        dialog.destroy()  
-        dialog.destroy()
-        # Did we press Ok? If yes, proceed
-        if Response == gtk.RESPONSE_OK:
-            try:
-                # Look for direct link to media file
-                if self.youtubeurl[-4]=='.':
-                    # find last '/'
-                    for i in range(len(self.youtubeurl)):
-                        if self.youtubeurl[-i]=='/':
-                            output=self.youtubeurl[-i+1:]
-                            break
-                    self.input.extend([os.getenv("HOME")+'/'+output])
-                    self.download(widget,self.youtubeurl)
-                    self.setinput(widget)
-                else:            
-                    self.download_youtube_dl(widget,self.youtubeurl)
-                    self.setinput(widget)
-            except:
-                pass
-            
-
-    def download(self,widget,url):
-        ####################
-        # Description
-        # ===========
-        """Copy the contents of a file from a given URL to a local file.""" 
-        # Arguments
-        # =========
-        # url   http url of the remote file to download eg. http://www.example.org/movie.mpg
-        #
-        # Further Details
-        # ===============
-        #
-        ####################   
-        webFile=urllib.urlretrieve(url, self.input[-1],lambda nb, bs, fs, url=url: self._reporthook(widget,nb,bs,fs,url))
-
-    def download_youtube_dl(self,widget,url):
-        ####################
-        # Description
-        # ===========
-        """Downloads video files from sites like youtube.com, metacafe.com and video.google.com.""" 
-        # Arguments
-        # =========
-        # url   http url of the remote file to download eg. http://www.example.org/movie.mpg
-        #
-        # Further Details
-        # ===============
-        # This function uses youtube-dl to get the url of the video and the title.
-        ####################   
-        
-        # Get video url from youtube-dl
-        command = ["youtube-dl-sinthgunt","-g",url]
-        output = ''
-        try:
-            process = subprocess.Popen(args=command,stdout=subprocess.PIPE,
-                    stdin=subprocess.PIPE,stderr=subprocess.STDOUT)
-            output = str(process.stdout.read())        
-        except:
-            None
-
-        # Remove trailing newline
-        video_url = output.strip()
-        
-        # Get video title from youtube-dl
-        command = ["youtube-dl-sinthgunt","-e",url]
-        output = ''
-        try:
-            process = subprocess.Popen(args=command,stdout=subprocess.PIPE,
-                    stdin=subprocess.PIPE,stderr=subprocess.STDOUT)
-            output = str(process.stdout.read())        
-        except:
-            None
-
-        # Remove trailing newline
-        video_title = output.strip()
-        
-        # Add file to input que
-        self.input.extend([os.getenv("HOME")+'/'+video_title+".flv"])
-
-        # Download the file
-        webFile=urllib.urlretrieve(video_url, self.input[-1],lambda nb, bs, fs, url=url: self._reporthook(widget,nb,bs,fs,url))
-
-
-    def _reporthook(self,widget,numblocks, blocksize, filesize, url=None):
-        ####################
-        # Description
-        # ===========
-        """Prints the download status to the status bar."""
-        # Arguments
-        # =========
-        #
-        # Further Details
-        # ===============
-        #
-        ####################  
-        base = os.path.basename(url)
-        #Should handle possible filesize=-1.
-        try:
-            percent = min((numblocks*blocksize*100)/filesize, 100)
-        except:
-            percent = 100
-        if numblocks != 0:
-            sys.stdout.write("\b"*70)
-        context_id = self.statusbar.get_context_id("Activation")  
-        self.statusbar.push(context_id,'Downloaded '+str(percent)+'% from '+self.youtubeurl)
-        self.progressbar.set_fraction(float(percent)/100)
-        if percent==100:
-            self.statusbar.push(context_id,'Downloaded completed. Saved as '+self.input[-1])
-            self.setinput(widget)
-        # Wait for gui to update
-        while gtk.events_pending():
-            gtk.main_iteration(False)
+        self.logfile.writelines('\nRow codecs:\n'+str(self.codecs)+'\n')
 
 
 #####################
 ## mplayer functions
 #####################
-    def mplayer_check(self,widget):
+    def mplayer_check(self, widget):
         ####################
         # Description
         # ===========
@@ -1190,12 +1198,12 @@
         #
         ####################
         return False 
-        if os.path.exist('/usr/bin/mplayer'):
+        if os.path.exists('/usr/bin/mplayer'):
             return True
         else:
             return False
        
-    def mplayer_play_input_file(self,widget):
+    def mplayer_play_input_file(self, widget):
         ####################
         # Description
         # ===========
@@ -1209,17 +1217,17 @@
         #
         ####################
         if self.mplayer_check:
-            whattoplay=' '
+            whattoplay = ' '
             try:
-                whattoplay=self.input[-1]
+                whattoplay = self.input[-1]
             except Exception, e:
                 raise e
-            command = ["mplayer","-vo","x11",whattoplay]
-            process = subprocess.Popen(args=command)
+            command = ['mplayer', '-vo', 'x11', whattoplay]
+            process = subprocess.Popen(args = command)
         else:    
             print 'Mplayer must be installed and found in /usr/bin for this function to work'
    
-    def mplayer_play_output_file(self,widget):
+    def mplayer_play_output_file(self, widget):
         ####################
         # Description
         # ===========
@@ -1233,13 +1241,13 @@
         #
         ####################  
         if self.mplayer_check:
-            whattoplay=' '
+            whattoplay = ' '
             try:
-                whattoplay=self.output
+                whattoplay = self.output
             except Exception, e:
                 raise e
-            command = ["mplayer","-vo","x11",whattoplay]
-            process = subprocess.Popen(args=command)
+            command = ['mplayer', '-vo', 'x11', whattoplay]
+            process = subprocess.Popen(args = command)
         else:
             print 'Mplayer must be installed and found in /usr/bin for this function to work'
 
@@ -1286,13 +1294,11 @@
                         "MainWindow_destroy"            : self.quit_program,
                         "on_menuquit_activate"          : self.quit_program,
                         "on_menuopen_activate"          : self.menuopenfile,
-                        "on_menuopenyoutube_activate"   : self.menuopenyoutube,
                         "on_toolbaropen_clicked"        : self.menuopenfile,
-                        "on_toolbaropenyoutube_clicked" : self.menuopenyoutube,
                         "on_menuconvert_activate"       : self.activate,
                         "on_menuabout_activate"         : self.aboutdialog,
                         "on_menuffmpeginfo_activate"    : self.ffmpeg_getinfo,
-                         "on_menuPlayInput_activate" : self.mplayer_play_input_file,
-                         "on_menuPlayOutput_activate"  : self.mplayer_play_output_file}
+                        "on_menuPlayInput_activate"     : self.mplayer_play_input_file,
+                        "on_menuPlayOutput_activate"    : self.mplayer_play_output_file}
             #Do the magic connecting to the widgets
             self.wTree.signal_autoconnect(self.dic)        
diff -3ur a/setup.py b/setup.py
--- a/setup.py	2013-02-15 18:23:20.000000000 +0400
+++ b/setup.py	2017-02-20 16:38:40.000000000 +0300
@@ -17,7 +17,7 @@
     license = 'GPLv3',
     packages = ['Sinthgunt'],
     package_data = {'sinthgunt': files},
-    scripts = ['sinthgunt','youtube-dl-sinthgunt'],
+    scripts = ['sinthgunt'],
     data_files=[
         ('/usr/share/sinthgunt',['share/sinthgunt.glade','share/presets.xml','share/logo.png','share/icon.png','README.txt','LICENSE.txt','sinthgunt.html']),
         ('/usr/share/applications',['share/sinthgunt.desktop']),
diff -3ur a/share/presets.xml b/share/presets.xml
--- a/share/presets.xml	2010-11-14 15:02:41.000000000 +0300
+++ b/share/presets.xml	2017-03-03 23:52:17.000000000 +0300
@@ -9,199 +9,199 @@
   </CDWavStereo>
   <GigabeatFS>
     <label>RB Toshiba Gigabeat F/X Fullscreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 320x240 -b 600k -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 320x240 -b:v 600k -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </GigabeatFS>
   <GigabeatWS>
     <label>RB Toshiba Gigabeat F/X Widescreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 320x176 -b 600k -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 320x176 -b:v 600k -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </GigabeatWS>
   <H1020FS>
     <label>RB iRiver H10 20GB Fullscreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 160x128 -b 224k -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 160x128 -b:v 224k -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </H1020FS>
   <H1020WS>
     <label>RB iRiver H10 20GB Widescreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 160x96 -b 224k -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 160x96 -b:v 224k -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </H1020WS>
   <H105FS>
     <label>RB iRiver H10 5/6GB Fullscreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 128x96 -b 224k -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 128x96 -b:v 224k -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </H105FS>
   <H105WS>
     <label>RB iRiver H10 5/6GB Widescreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 128x80 -b 224k -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 128x80 -b:v 224k -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </H105WS>
   <H300FS>
     <label>RB iRiver H300 Fullscreen</label>
-    <params>-acodec libmp3lame -ab 96k -ar 44100 -vcodec mpeg2video -s 224x176 -b 224k -r 10 -strict -1</params>
+    <params>-acodec libmp3lame -ab 96k -ar 44100 -vcodec mpeg2video -s 224x176 -b:v 224k -r 10 -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </H300FS>
   <H300WS>
     <label>RB iRiver H300 Widescreen</label>
-    <params>-acodec libmp3lame -ab 96k -ar 44100 -vcodec mpeg2video -s 224x128 -b 256k -r 15 -strict -1</params>
+    <params>-acodec libmp3lame -ab 96k -ar 44100 -vcodec mpeg2video -s 224x128 -b:v 256k -r 15 -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </H300WS>
   <I5GFS>
     <label>RB Apple iPod Video Fullscreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 320x240 -b 400k -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 320x240 -b:v 400k -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </I5GFS>
   <I5GWS>
     <label>RB Apple iPod Video Widescreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 320x176 -b 400k -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 320x176 -b:v 400k -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </I5GWS>
   <M4a>
     <label>MPEG4 Audio</label>
     <params>-vn -acodec libfaac -ab 112k -ac 2</params>
-    <extension>m4a</extension>
+    <extension>aac</extension>
     <category>Audio</category>
-    <codecs>libfaac</codecs>
+    <codecs>aac</codecs>
   </M4a>
   <NeurosOSDTVHQNTSC>
     <label>Neuros HQ NTSC Fullscreen</label>
-    <params>-f mp4 -r 29.97 -vcodec libxvid -vf scale=640:480,aspect=4:3  -maxrate 2500k -b 2000k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -flags +mv4 -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libfaac -ar 48000 -ab 128k -ac 2</params>
+    <params>-f mp4 -r 29.97 -vcodec libxvid -s 640x480 -aspect 4:3 -b:v 2000k -acodec libfaac -ar 48000 -ab 128k -ac 2</params>
     <extension>mp4</extension>
     <category>Neuros OSD</category>
-    <codecs>libxvid,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </NeurosOSDTVHQNTSC>
   <NeurosOSDTVHQPAL>
     <label>Neuros HQ PAL Fullscreen</label>
-    <params>-f mp4 -r 25 -vcodec libxvid -vf scale=640:480,aspect=4:3  -maxrate 2500k -b 2000k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -flags +mv4 -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libfaac -ar 48000 -ab 128k -ac 2</params>
+    <params>-f mp4 -r 25 -vcodec libxvid -s 640x480 -aspect 4:3 -b:v 2000k -acodec libfaac -ar 48000 -ab 128k -ac 2</params>
     <extension>mp4</extension>
     <category>Neuros OSD</category>
-    <codecs>libxvid,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </NeurosOSDTVHQPAL>
   <NeurosOSDTVSFNTSC>
     <label>Neuros Small File NTSC Fullscreen</label>
-    <params>-f mp4 -b 800k -r 29.97 -vf scale=320:240,aspect=4:3  -vcodec libxvid -ar 48000 -ab 80k -ac 2 -acodec libfaac</params>
+    <params>-f mp4 -b:v 800k -r 29.97 -s 320x240 -aspect 4:3 -vcodec libxvid -ar 48000 -ab 80k -ac 2 -acodec libfaac</params>
     <extension>mp4</extension>
     <category>Neuros OSD</category>
-    <codecs>libxvid,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </NeurosOSDTVSFNTSC>
   <NeurosOSDTVSFPAL>
     <label>Neuros Small File PAL Fullscreen</label>
-    <params>-f mp4 -b 800k -r 25 -vf scale=320:240,aspect=4:3  -vcodec libxvid -ar 48000 -ab 80k -ac 2 -acodec libfaac</params>
+    <params>-f mp4 -b:v 800k -r 25 -s 320x240 -aspect 4:3 -vcodec libxvid -ar 48000 -ab 80k -ac 2 -acodec libfaac</params>
     <extension>mp4</extension>
     <category>Neuros OSD</category>
-    <codecs>libxvid,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </NeurosOSDTVSFPAL>
   <NeurosOSDTVWSHQNTSC>
     <label>Neuros HQ NTSC Widescreen</label>
-    <params>-f mp4 -r 29.97 -vcodec libxvid -vf scale=704:384,aspect=16:9  -maxrate 3000k -b 2500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -flags +mv4 -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libfaac -ar 48000 -ab 128k -ac 2</params>
+    <params>-f mp4 -r 29.97 -vcodec libxvid -s 704x384 -aspect 16:9 -b:v 2500k -acodec libfaac -ar 48000 -ab 128k -ac 2</params>
     <extension>mp4</extension>
     <category>Neuros OSD</category>
-    <codecs>libxvid,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </NeurosOSDTVWSHQNTSC>
   <NeurosOSDTVWSHQPAL>
     <label>Neuros HQ PAL Widescreen</label>
-    <params>-f mp4 -r 25 -vcodec libxvid -vf scale=704:384,aspect=16:9  -maxrate 3000k -b 2500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -flags +mv4 -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libfaac -ar 48000 -ab 128k -ac 2</params>
+    <params>-f mp4 -r 25 -vcodec libxvid -s 704x384 -aspect 16:9 -b:v 2500k -acodec libfaac -ar 48000 -ab 128k -ac 2</params>
     <extension>mp4</extension>
     <category>Neuros OSD</category>
-    <codecs>libxvid,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </NeurosOSDTVWSHQPAL>
   <NeurosOSDTVWSSFNTSC>
     <label>Neuros Small File NTSC Widescreen</label>
-    <params>-f mp4 -b 800k -r 29.97 -vf scale=352:240,aspect=16:9  -vcodec libxvid -ar 48000 -ab 80k -ac 2 -acodec libfaac</params>
+    <params>-f mp4 -b:v 800k -r 29.97 -s=352x240 -aspect 16:9 -vcodec libxvid -ar 48000 -ab 80k -ac 2 -acodec libfaac</params>
     <extension>mp4</extension>
     <category>Neuros OSD</category>
-    <codecs>libxvid,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </NeurosOSDTVWSSFNTSC>
   <NeurosOSDTVWSSFPAL>
     <label>Neuros Small File PAL Widescreen</label>
-    <params>-f mp4 -b 800k -r 25 -vf scale=352:240,aspect=16:9  -vcodec libxvid -ar 48000 -ab 80k -ac 2 -acodec libfaac</params>
+    <params>-f mp4 -b:v 800k -r 25 -s 352x240 -aspect 16:9 -vcodec libxvid -ar 48000 -ab 80k -ac 2 -acodec libfaac</params>
     <extension>mp4</extension>
     <category>Neuros OSD</category>
-    <codecs>libxvid,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </NeurosOSDTVWSSFPAL>
   <PalmXviDFS>
     <label>Palm Fullscreen</label>
-    <params>-f mp4 -r 29.97 -vcodec libxvid -vf scale=428:320,aspect=4:3  -maxrate 550k -b 500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -flags +mv4 -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libfaac -ar 44100 -ab 80k -ac 2</params>
+    <params>-f mp4 -vcodec libxvid -s 428x320 -aspect 4:3 -b:v 500k -acodec libfaac -ar 44100 -ab 80k -ac 2</params>
     <extension>mp4</extension>
     <category>Palm</category>
-    <codecs>libxvid,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </PalmXviDFS>
   <PalmXviDWS>
     <label>Palm Widescreen</label>
-    <params>-f mp4 -r 29.97 -vcodec libxvid -vf scale=480:320,aspect=3:2  -maxrate 450k -b 430k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -flags +mv4 -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libfaac -ar 44100 -ab 80k -ac 2</params>
+    <params>-f mp4 -vcodec libxvid -s 480x320 -aspect 3:2 -b:v 430k -acodec libfaac -ar 44100 -ab 80k -ac 2</params>
     <extension>mp4</extension>
     <category>Palm</category>
-    <codecs>libxvid,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </PalmXviDWS>
   <PhotoFS>
     <label>RB Apple iPod Photo/Color Fullscreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 224x176 -b 320k -r 15 -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 224x176 -b:v 320k -r 15 -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </PhotoFS>
   <PhotoWS>
     <label>RB Apple iPod Photo/Color Widescreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 224x128 -b 320k -r 24 -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 224x128 -b:v 320k -r 24 -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </PhotoWS>
   <X5FS>
     <label>RB Cowon iAudio X5 Fullscreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 160x128 -b 176k -r 15 -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 160x128 -b:v 176k -r 15 -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </X5FS>
   <X5WS>
     <label>RB Cowon iAudio X5 Widescreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 160x96 -b 224k -r 24 -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 160x96 -b:v 224k -r 24 -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
-    <codecs>libmp3lame,mpeg2video</codecs>
+    <codecs>mp3,mpeg2video</codecs>
   </X5WS>
   <XviDAVIFS>
     <label>XviD FullScreen</label>
-    <params>-f avi -r 29.97 -vcodec libxvid -vtag XVID -vf scale=640:480,aspect=4:3  -maxrate 1800k -b 1500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -flags +mv4 -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
+    <params>-f avi -vcodec libxvid -vtag xvid -s 640x480 -aspect 4:3 -b:v 1500k -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
     <extension>avi</extension>
     <category>AVI</category>
-    <codecs>libxvid,libmp3lame</codecs>
+    <codecs>mpeg4,mp3</codecs>
   </XviDAVIFS>
   <XviDAVIWS>
     <label>XviD Widescreen</label>
-    <params>-f avi -r 29.97 -vcodec libxvid -vtag XVID -vf scale=704:384,aspect=16:9  -maxrate 1800k -b 1500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -flags +mv4 -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
+    <params>-f avi -vcodec libxvid -vtag xvid -s 704x396 -aspect 16:9 -b:v 1500k -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
     <extension>avi</extension>
     <category>AVI</category>
-    <codecs>libxvid,libmp3lame</codecs>
+    <codecs>mpeg4,mp3</codecs>
   </XviDAVIWS>
   <XviDAVIWSAna>
     <label>XviD Widescreen Anamorphic</label>
-    <params>-f avi -r 29.97 -croptop 58 -cropbottom 62 -vcodec libxvid -vtag XVID -vf scale=640:272 -aspect 2.35 -maxrate 1800k -b 1500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -flags +mv4 -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
+    <params>-f avi -vf crop=in_h-2*60 -vcodec libxvid -vtag xvid -s 640x272 -aspect 2.35 -b:v 1500k -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
     <extension>avi</extension>
     <category>AVI</category>
-    <codecs>libxvid,libmp3lame</codecs>
+    <codecs>mpeg4,mp3</codecs>
   </XviDAVIWSAna>
   <ac3dvd192>
     <label>Ac3 DVD - 192kbps Stereo</label>
@@ -219,10 +219,10 @@
   </ac3dvd384>
   <divx>
     <label>MS Compatible AVI</label>
-    <params>-acodec libmp3lame -vcodec msmpeg4 -ab 192k -b 1000k -s 640x480</params>
+    <params>-acodec libmp3lame -vcodec msmpeg4v3 -ab 192k -b:v 1000k -s 640x480</params>
     <extension>avi</extension>
     <category>AVI</category>
-    <codecs>msmpeg4,libmp3lame</codecs>
+    <codecs>msmpeg4v3,mp3</codecs>
   </divx>
   <dvntsc>
     <label>Raw DV for NTSC Fullscreen</label>
@@ -240,14 +240,14 @@
   </dvpal>
   <e200FS>
     <label>RB Sandisk Sansa e200 Fullscreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 224x176 -b 320k -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 224x176 -b:v 320k -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
     <codecs>mpeg2video,libmp3lame</codecs>
   </e200FS>
   <e200WS>
     <label>RB Sandisk Sansa e200 Widescreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 224x128 -b 320k -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 224x128 -b:v 320k -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
     <codecs>mpeg2video,libmp3lame</codecs>
@@ -257,116 +257,116 @@
     <params>-acodec libmp3lame -ab 160k -ac 2 -ar 44100</params>
     <extension>mp3</extension>
     <category>Audio</category>
-    <codecs>libmp3lame</codecs>
+    <codecs>mp3</codecs>
   </mp3>
   <mp3m>
     <label>MP3 (Mono)</label>
     <params>-acodec libmp3lame -ab 32k -ac 1 -ar 22050</params>
     <extension>mp3</extension>
     <category>Mobile Phones</category>
-    <codecs>libmp3lame</codecs>
+    <codecs>mp3</codecs>
   </mp3m>
   <nanoFS>
     <label>RB Apple iPod Nano Fullscreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 176x128 -b 256k -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 176x128 -b:v 256k -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
     <codecs>mpeg2video,libmp3lame</codecs>
   </nanoFS>
   <nanoWS>
     <label>RB Apple iPod Nano Widescreen</label>
-    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 176x128 -b 256k -strict -1</params>
+    <params>-acodec libmp3lame -ab 128k -ar 44100 -vcodec mpeg2video -s 176x128 -b:v 256k -strict -1</params>
     <extension>mpg</extension>
     <category>Rockbox</category>
     <codecs>mpeg2video,libmp3lame</codecs>
   </nanoWS>
   <ntscdvdgoodqFS>
     <label>NTSC DVD Fullscreen</label>
-    <params>-f dvd -vcodec mpeg2video -r 29.97 -s 352x480 -aspect 4:3 -b 4000k -mbd rd -trellis -mv0 -cmp 2 -subcmp 2 -acodec mp2 -ab 192k -ar 48000 -ac 2</params>
+    <params>-f dvd -vcodec mpeg2video -r 29.97 -s 352x480 -aspect 4:3 -b:v 4000k -mbd rd -trellis 2 -flags mv0 -cmp 2 -subcmp 2 -acodec mp2 -ab 192k -ar 48000 -ac 2</params>
     <extension>mpg</extension>
     <category>DVD</category>
     <codecs>mpeg2video,mp2</codecs>
   </ntscdvdgoodqFS>
   <ntscdvdgoodqWS>
     <label>NTSC DVD Widescreen</label>
-    <params>-f dvd -vcodec mpeg2video -r 29.97 -s 352x480 -aspect 16:9 -b 4000k -mbd rd -trellis -mv0 -cmp 2 -subcmp 2 -acodec mp2 -ab 192k -ar 48000 -ac 2</params>
+    <params>-f dvd -vcodec mpeg2video -r 29.97 -s 352x480 -aspect 16:9 -b:v 4000k -mbd rd -trellis 2 -flags mv0 -cmp 2 -subcmp 2 -acodec mp2 -ab 192k -ar 48000 -ac 2</params>
     <extension>mpg</extension>
     <category>DVD</category>
     <codecs>mpeg2video,mp2</codecs>
   </ntscdvdgoodqWS>
   <ntscdvdhqFS>
     <label>NTSC DVD HQ Fullscreen</label>
-    <params>-f dvd -target ntsc-dvd -r 29.97 -s 720x480 -aspect 4:3 -b 8000k -mbd rd -trellis -mv0 -cmp 0 -subcmp 2</params>
+    <params>-f dvd -target ntsc-dvd -r 29.97 -s 720x480 -aspect 4:3 -b:v 8000k -mbd rd -trellis 2 -flags mv0 -cmp 0 -subcmp 2</params>
     <extension>mpg</extension>
     <category>DVD</category>
-    <codecs>dvd</codecs>
+    <codecs>mpeg2video,mp2</codecs>
   </ntscdvdhqFS>
   <ntscdvdhqWS>
     <label>NTSC DVD HQ Widescreen</label>
-    <params>-f dvd -target ntsc-dvd -r 29.97 -s 720x480 -aspect 16:9 -b 8000k -g 12 -mbd rd -trellis -mv0 -cmp 0 -subcmp 2</params>
+    <params>-f dvd -target ntsc-dvd -r 29.97 -s 720x480 -aspect 16:9 -b:v 8000k -g 12 -mbd rd -trellis 2 -flags mv0 -cmp 0 -subcmp 2</params>
     <extension>mpg</extension>
     <category>DVD</category>
-    <codecs>dvd</codecs>
+    <codecs>mpeg2video,mp2</codecs>
   </ntscdvdhqWS>
   <ntscdvdlq>
     <label>NTSC DVD Fast (LQ)</label>
-    <params>-f dvd -target ntsc-dvd -b 5000k -r 29.97 -s 720x480 -ar 48000 -ab 384kb</params>
+    <params>-f dvd -target ntsc-dvd -b:v 5000k -r 29.97 -s 720x480 -ar 48000 -ab 384kb</params>
     <extension>mpg</extension>
     <category>DVD</category>
-    <codecs>dvd</codecs>
+    <codecs>mpeg2video,mp2</codecs>
   </ntscdvdlq>
   <ntscvcdhq>
     <label>NTSC VCD (HQ)</label>
-    <params>-f vcd -target ntsc-vcd -mbd rd -trellis -mv0 -cmp 0 -subcmp 2</params>
+    <params>-f vcd -target ntsc-vcd -mbd rd -trellis 2 -flags mv0 -cmp 0 -subcmp 2</params>
     <extension>mpg</extension>
     <category>VCD</category>
     <codecs>vcd</codecs>
   </ntscvcdhq>
   <paldvdgoodqFS>
     <label>PAL DVD Fullscreen</label>
-    <params>-f dvd -vcodec mpeg2video -r 25.00 -s 352x576  -aspect 4:3 -b 4000k -mbd rd -trellis -mv0 -cmp 2 -subcmp 2 -acodec mp2 -ab 192k -ar 48000 -ac 2</params>
+    <params>-f dvd -vcodec mpeg2video -r 25.00 -s 576x324 -aspect 4:3 -b:v 4000k -mbd rd -trellis 2 -flags mv0 -cmp 2 -subcmp 2 -acodec mp2 -ab 192k -ar 48000 -ac 2</params>
     <extension>mpg</extension>
     <category>DVD</category>
     <codecs>mpeg2video,mp2</codecs>
   </paldvdgoodqFS>
   <paldvdgoodqWS>
     <label>PAL DVD Widescreen</label>
-    <params>-f dvd -vcodec mpeg2video -r 25.00 -s 352x576 -aspect 16:9 -b 4000k -mbd rd -trellis -mv0 -cmp 2 -subcmp 2 -acodec mp2 -ab 192k -ar 48000 -ac 2</params>
+    <params>-f dvd -vcodec mpeg2video -r 25.00 -s 576x324 -aspect 16:9 -b:v 4000k -mbd rd -trellis 2 -flags mv0 -cmp 2 -subcmp 2 -acodec mp2 -ab 192k -ar 48000 -ac 2</params>
     <extension>mpg</extension>
     <category>DVD</category>
     <codecs>mpeg2video,mp2</codecs>
   </paldvdgoodqWS>
   <paldvdhqFS>
     <label>PAL DVD HQ Fullscreen</label>
-    <params>-f dvd -target pal-dvd -aspect 4:3 -b 8000k -mbd rd -trellis -mv0 -cmp 0 -subcmp 2</params>
+    <params>-f dvd -target pal-dvd -aspect 4:3 -b:v 8000k -mbd rd -trellis 2 -flags mv0 -cmp 0 -subcmp 2</params>
     <extension>mpg</extension>
     <category>DVD</category>
-    <codecs>dvd</codecs>
+    <codecs>mpeg2video,mp2</codecs>
   </paldvdhqFS>
   <paldvdhqWS>
     <label>PAL DVD HQ Widescreen</label>
-    <params>-f dvd -target pal-dvd -aspect 16:9 -b 8000k -mbd rd -trellis -mv0 -cmp 0 -subcmp 2</params>
+    <params>-f dvd -target pal-dvd -aspect 16:9 -b:v 8000k -mbd rd -trellis 2 -flags mv0 -cmp 0 -subcmp 2</params>
     <extension>mpg</extension>
     <category>DVD</category>
-    <codecs>dvd</codecs>
+    <codecs>mpeg2video,mp2</codecs>
   </paldvdhqWS>
   <paldvdlq>
     <label>PAL DVD Fast (LQ)</label>
-    <params>-f dvd -target pal-dvd -b 5000k -r 25 -s 720x576 -ar 48000 -ab 384kb</params>
+    <params>-f dvd -target pal-dvd -b:v 5000k -r 25 -s 720x576 -ar 48000 -ab 384kb</params>
     <extension>mpg</extension>
     <category>DVD</category>
-    <codecs>dvd</codecs>
+    <codecs>mpeg2video,mp2</codecs>
   </paldvdlq>
   <palvcdhq>
     <label>PAL VCD (HQ)</label>
-    <params>-f vcd -target pal-vcd -mbd rd -trellis -mv0 -cmp 0 -subcmp 2</params>
+    <params>-f vcd -target pal-vcd -mbd rd -trellis 2 -flags mv0 -cmp 0 -subcmp 2</params>
     <extension>mpg</extension>
     <category>VCD</category>
     <codecs>vcd</codecs>
   </palvcdhq>
   <qmov>
     <label>Quicktime MOV</label>
-    <params>-f mov -acodec libfaac -b 1250k -r 25 -ab 128k -s 640x480</params>
+    <params>-f mov -acodec libfaac -b:v 1250k -r 25 -ab 128k -s 640x480</params>
     <extension>mov</extension>
     <category>Quicktime</category>
     <codecs>mov,libfaac</codecs>
@@ -380,72 +380,72 @@
   </wma>
   <wmv>
     <label>WMV2 Generic</label>
-    <params>-vcodec wmv2  -acodec wmav2 -b 1000k -ab 160k -r 25</params>
+    <params>-vcodec wmv2 -acodec wmav2 -b:v 1000k -ab 160k -r 25</params>
     <extension>wmv</extension>
     <category>Microsoft</category>
     <codecs>wmv2,wmav2</codecs>
   </wmv>
   <x264HQFS>
     <label>MP4 Fullscreen</label>
-    <params>-f mp4 -r 29.97 -vcodec libx264 -vpre medium -s 640x480 -b 1000k -aspect 4:3 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -b 1250k -maxrate 1500k -bufsize 4M -bt 256k -refs 1 -bf 3 -coder 1 -me_method umh -me_range 16 -subq 7 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -qcomp 0.6 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+    <params>-f mp4 -vcodec libx264 -s 640x480 -b:v 1000k -aspect 4:3 -acodec libfaac -ab 112k -ar 44100 -ac 2</params>
     <extension>mp4</extension>
     <category>MPEG4</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </x264HQFS>
   <x264HQPSP43>
     <label>PSP Fullscreen</label>
-    <params>-f mp4 -r 29.97 -vcodec libx264 -vpre medium -s 640x480 -aspect 4:3 -b 1250k -maxrate 4M -bufsize 4M -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method umh -subq 6 -trellis 1 -refs 2 -bf 1 -coder 1 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 1250k -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 21 -acodec libfaac -ab 128k -ar 48000 -ac 2</params>
+    <params>-f mp4 -vcodec libx264 -s 640x480 -aspect 4:3 -b:v 1250k -acodec libfaac -ab 128k -ar 48000 -ac 2</params>
     <extension>mp4</extension>
     <category>PSP</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </x264HQPSP43>
   <x264HQWS>
     <label>MP4 Widescreen</label>
-    <params>-f mp4 -r 29.97 -vcodec libx264 -vpre medium -s 704x384 -b 1000k -aspect 16:9 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -b 1250k -maxrate 1500k -bufsize 4M -bt 256k -refs 1 -bf 3 -coder 1 -me_method umh -me_range 16 -subq 7 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -qcomp 0.6 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+    <params>-f mp4 -vcodec libx264 -s 704x396 -b:v 1000k -aspect 16:9 -acodec libfaac -ab 112k -ar 44100 -ac 2</params>
     <extension>mp4</extension>
     <category>MPEG4</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </x264HQWS>
   <cdma3g>
     <label>CDMA Phone Audio (3g2)</label>
     <params>-f 3g2 -ar 22050 -ab 128k -acodec libfaac -s qcif -r 14.985 -vn</params>
     <extension>3g2</extension>
     <category>Mobile Phones</category>
-    <codecs>3g2,libfaac</codecs>
+    <codecs>3g2,aac</codecs>
   </cdma3g>
   <XviDAVIZENFS>
     <label>Zen Fullscreen</label>
-    <params>-f avi -r 29.97 -vcodec libxvid -vtag XVID -vf scale=320:240,aspect=4:3  -maxrate 1800k -b 1500k  -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
+    <params>-f avi -vcodec libxvid -vtag xvid -s 320x240 -aspect 4:3 -maxrate 1800k -b:v 1500k -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
     <extension>avi</extension>
     <category>Creative Zen</category>
-    <codecs>libxvid,libmp3lame</codecs>
+    <codecs>mpeg4,mp3</codecs>
   </XviDAVIZENFS>
   <XviDAVIZENWS>
     <label>Zen Widescreen</label>
-    <params>-f avi -r 29.97 -vcodec libxvid -vtag XVID -vf scale=320:240,aspect=16:9  -maxrate 1800k -b 1500k  -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
+    <params>-f avi -vcodec libxvid -vtag xvid -s 320x240 -aspect 16:9 -maxrate 1800k -b:v 1500k -acodec libmp3lame -ar 48000 -ab 128k -ac 2</params>
     <extension>avi</extension>
     <category>Creative Zen</category>
-    <codecs>libxvid,libmp3lame</codecs>
+    <codecs>mpeg4,mp3</codecs>
   </XviDAVIZENWS>
   <BlackberryCurvefs>
     <label>Blackberry Curve Fullscreen</label>
-    <params>-f mp4 -vcodec mpeg4 -b 400k -r 24 -s 320x240 -aspect 4:3 -acodec libfaac -ar 22050 -ac 2 -ab 48kb</params>
+    <params>-f mp4 -vcodec mpeg4 -b:v 400k -r 24 -s 320x240 -aspect 4:3 -acodec libfaac -ar 22050 -ac 2 -ab 48kb</params>
     <extension>mp4</extension>
     <category>Blackberry</category>
-    <codecs>mpeg4,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </BlackberryCurvefs>
   <BlackberryCurvews>
     <label>Blackberry Curve Widescreen</label>
-    <params>-f mp4 -vcodec mpeg4 -b 400k -r 24 -s 320x180 -aspect 16:9 -acodec libfaac -ar 22050 -ac 2 -ab 48kb</params>
+    <params>-f mp4 -vcodec mpeg4 -b:v 400k -r 24 -s 320x180 -aspect 16:9 -acodec libfaac -ar 22050 -ac 2 -ab 48kb</params>
     <extension>mp4</extension>
     <category>Blackberry</category>
   </BlackberryCurvews>
   <lgchocolate>
     <label>LG Chocolate</label>
-    <params>-f mp4 -vf scale=240:192 -r 11.988 -b 192k -ab 56k -vcodec libxvid -acodec libfaac</params>
+    <params>-f mp4 -s 240x192 -r 11.988 -b:v 192k -ab 56k -vcodec libxvid -acodec libfaac</params>
     <extension>mp4</extension>
     <category>LG</category>
-    <codecs>mp4,libxvid,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </lgchocolate>
   <blackberrymp3>
     <label>Blackberry Music</label>
@@ -456,44 +456,44 @@
   </blackberrymp3>
   <blackberryws>
     <label>Blackberry Video Widescreen</label>
-    <params>-f mp4 -r 24 -vcodec libx264 -vpre medium -s 320x180 -aspect 16:9 -maxrate 800k -bufsize 80k -b 400k -acodec libfaac -ar 44100 -ab 80k -ac 2</params>
+    <params>-f mp4 -r 24 -vcodec libx264 -s 320x180 -aspect 16:9 -b:v 400k -acodec libfaac -ar 44100 -ab 80k -ac 2</params>
     <extension>mp4</extension>
     <category>Blackberry</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </blackberryws>
   <blackberryfs>
     <label>Blackberry Video Fullscreen</label>
-    <params>-f mp4 -r 24 -vcodec libx264 -vpre medium -s 240x180 -aspect 4:3 -maxrate 800k -bufsize 80k -b 400k -acodec libfaac -ar 44100 -ab 80k -ac 2</params>
+    <params>-f mp4 -r 24 -vcodec libx264 -s 240x180 -aspect 4:3 -b:v 400k -acodec libfaac -ar 44100 -ab 80k -ac 2</params>
     <extension>mp4</extension>
     <category>Blackberry</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </blackberryfs>
     <flvweb50>
     <label>Flash: Video (flv) for Web use. 448x336, 50 kb/s</label>
-    <params>-vcodec flv -ar 22050 -r 24 -b 50k -s 448x336 -acodec libmp3lame</params>
+    <params>-vcodec flv -ar 22050 -r 24 -b:v 50k -s 448x336 -acodec libmp3lame</params>
     <extension>flv</extension>
     <category>Websites</category>
-    <codecs>flv,libmp3lame</codecs>
+    <codecs>flv,mp3</codecs>
   </flvweb50>
   <flvweb150>
     <label>Flash: Video (flv) for Web use. 448x336, 150 kb/s</label>
-    <params>-vcodec flv -ar 22050 -r 24 -b 150k -s 448x336 -acodec libmp3lame</params>
+    <params>-vcodec flv -ar 22050 -r 24 -b:v 150k -s 448x336 -acodec libmp3lame</params>
     <extension>flv</extension>
     <category>Websites</category>
-    <codecs>flv,libmp3lame</codecs>
+    <codecs>flv,mp3</codecs>
   </flvweb150>
    <flvweb350>
     <label>Flash: Video (flv) for Web use. 448x336, 350 kb/s</label>
-    <params>-vcodec flv -ar 22050 -r 24 -b 350k -s 448x336 -acodec libmp3lame</params>
+    <params>-vcodec flv -ar 22050 -r 24 -b:v 350k -s 448x336 -acodec libmp3lame</params>
     <extension>flv</extension>
     <category>Websites</category>
-    <codecs>flv,libmp3lame</codecs>
+    <codecs>flv,mp3</codecs>
    </flvweb350> <x264HQPSP169robertswain>
     <label>PSP Widescreen</label>
-    <params>-f mp4 -r 29.97 -vcodec libx264 -vpre medium -s 480x272 -aspect 16:9 -b 1250k -maxrate 4M -bufsize 4M -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method umh -subq 6 -trellis 1 -refs 2 -bf 1 -coder 1 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 1250k -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 21 -acodec libfaac -ab 128k -ar 48000 -ac 2</params>
+    <params>-f mp4 -vcodec libx264 -s 480x272 -aspect 16:9 -b:v 1250k -acodec libfaac -ab 128k -ar 48000 -ac 2</params>
     <extension>mp4</extension>
     <category>PSP</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   <WebmLargeFull>
     <label>WebM Video for HTML5 Full Screen - 640x480</label>
     <params>-f webm -s 640x480 -aspect 4:3 -vcodec libvpx -deinterlace -g 120 -level 216 -profile 0 -qmax 42 -qmin 10 -rc_buf_aggressivity 0.95 -vb 2M -acodec libvorbis -aq 60 -ac 2</params>
@@ -525,101 +525,101 @@
   </x264HQPSP169robertswain>
   <iPodiTunesSmallCRF21FS>
     <label>iPod Small Fullscreen</label>
-    <params>-r 29.97 -vcodec libx264 -vpre medium -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 21 -bt 256k -refs 1 -coder 0 -me_method full -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -s 320x240 -aspect 4:3 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+    <params>-r 29.97 -vcodec libx264 -bt 256k -s 320x240 -aspect 4:3 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
     <extension>m4v</extension>
     <category>iPod-iTunes</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </iPodiTunesSmallCRF21FS>
   <iPodiTunesSmallCRF21WS>
     <label>iPod Small WideScreen</label>
-    <params>-r 29.97 -vcodec libx264 -vpre medium -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 21 -bt 256k -refs 1 -coder 0 -me_method full -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -s 320x176 -aspect 16:9 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+    <params>-r 29.97 -vcodec libx264 -bt 256k -s 320x176 -aspect 16:9 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
     <extension>m4v</extension>
     <category>iPod-iTunes</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </iPodiTunesSmallCRF21WS>
   <iPodiTunesSmallCRF21WSAna>
     <label>iPod Small WideScreen Anamorphic</label>
-    <params>-r 29.97 -croptop 60 -cropbottom 60 -vcodec libx264 -vpre medium -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 21 -bt 256k -refs 1 -coder 0 -me_method full -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -s 320x144 -aspect 2.35 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+    <params>-r 29.97 -vf crop=in_h-2*60 -vcodec libx264 -bt 256k -s 320x144 -aspect 2.35 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
     <extension>m4v</extension>
     <category>iPod-iTunes</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </iPodiTunesSmallCRF21WSAna>
   <iPodiTunesSmallCRF21WSLBFix>
     <label>iPod Small Converted to WideScreen</label>
-    <params>-r 29.97 -croptop 64 -cropbottom 64 -vcodec libx264 -vpre medium -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 21 -bt 256k -refs 1 -coder 0 -me_method full -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -s 320x176 -aspect 16:9 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+    <params>-r 29.97 -vf crop=in_h-2*64 -vcodec libx264 -bt 256k -s 320x176 -aspect 16:9 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
     <extension>m4v</extension>
     <category>iPod-iTunes</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </iPodiTunesSmallCRF21WSLBFix>
   <iPodiTunesTVOutCRF21FS>
     <label>iPod TV Out Fullscreen</label>
-    <params>-r 29.97 -vcodec libx264 -vpre medium -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 21 -bt 256k -refs 1 -coder 0 -me_method full -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -s 512x384 -aspect 4:3 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+    <params>-r 29.97 -vcodec libx264 -bt 256k -s 512x384 -aspect 4:3 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
     <extension>m4v</extension>
     <category>iPod-iTunes</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </iPodiTunesTVOutCRF21FS>
   <iPodiTunesTVOutCRF21WS>
     <label>iPod TV Out Widescreen</label>
-    <params>-r 29.97 -vcodec libx264 -vpre medium -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 21 -bt 256k -refs 1 -coder 0 -me_method full -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -s 624x352 -aspect 16:9 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+    <params>-r 29.97 -vcodec libx264 -bt 256k -s 624x352 -aspect 16:9 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
     <extension>m4v</extension>
     <category>iPod-iTunes</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </iPodiTunesTVOutCRF21WS>
   <iPodiTunesTVOutCRF21WSAna>
     <label>iPod TV Out Widescreen Anamorphic</label>
-    <params>-r 29.97 -croptop 60 -cropbottom 60 -vcodec libx264 -vpre medium -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 21 -bt 256k -refs 1 -coder 0 -me_method full -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -s 640x272 -aspect 2.35 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+    <params>-r 29.97 -vf crop=in_h-2*60 -vcodec libx264 -bt 256k -s 640x272 -aspect 2.35 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
     <extension>m4v</extension>
     <category>iPod-iTunes</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </iPodiTunesTVOutCRF21WSAna>
   <iPodiTunesTVOutCRF21WSLBFix>
     <label>iPod TV Out Converted to Widescreen</label>
-    <params>-r 29.97 -croptop 64 -cropbottom 64 -vcodec libx264 -vpre medium -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0 -crf 21 -bt 256k -refs 1 -coder 0 -me_method full -me_range 16 -subq 5 -partitions +parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -s 640x352 -aspect 16:9 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
+    <params>-r 29.97 -vf crop=in_h-2*64 -vcodec libx264 -bt 256k -s 640x352 -aspect 16:9 -acodec libfaac -ab 112k -ar 48000 -ac 2</params>
     <extension>m4v</extension>
     <category>iPod-iTunes</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </iPodiTunesTVOutCRF21WSLBFix>
   <ogg1>
     <label>OGG</label>
-    <params>-acodec vorbis -aq 60  -vn</params>
-    <extension>OGG</extension>
+    <params>-acodec libvorbis -aq 60 -vn</params>
+    <extension>ogg</extension>
     <category>Audio</category>
-    <codecs>vorbis</codecs>
+    <codecs>ogg</codecs>
   </ogg1>
   <wmv4powerpoint>
     <label>Power Point</label>
-    <params>-vcodec wmv2  -acodec wmav2 -aspect 4:3 -b 500k -ab 32k -ac 1 -ar 22050 -s 320x240</params>
+    <params>-vcodec wmv2 -acodec wmav2 -aspect 4:3 -b:v 500k -ab 32k -ac 1 -ar 22050 -s 320x240</params>
     <extension>wmv</extension>
     <category>Microsoft</category>
     <codecs>wmv2,wmav2</codecs>
   </wmv4powerpoint>
   <wmv2zune>
     <label>Zune</label>
-    <params>-vcodec wmv2  -acodec wmav2 -b 640k -ab 128k -r 23.97 -s 320x240</params>
+    <params>-vcodec wmv2 -acodec wmav2 -b:v 640k -ab 128k -r 23.97 -s 320x240</params>
     <extension>wmv</extension>
     <category>Microsoft</category>
     <codecs>wmv2,wmav2</codecs>
   </wmv2zune>
   <wmv2broadband>
     <label>WMV for Web Use</label>
-    <params>-vcodec wmv2  -acodec wmav2 -b 640k -ab 128k -r 29.97 -s 320x240</params>
+    <params>-vcodec wmv2 -acodec wmav2 -b:v 640k -ab 128k -r 29.97 -s 320x240</params>
     <extension>wmv</extension>
     <category>Microsoft</category>
     <codecs>wmv2,wmav2</codecs>
   </wmv2broadband>
   <ps3720p>
     <label>PS3 720p Widescreen</label>
-    <params>-f mp4 -r 23.976 -vcodec libx264 -vpre medium -s 1280x720 -b 3000k -aspect 16:9 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0  -maxrate 3500k -bufsize 4M -bt 256k -refs 1 -bf 3 -coder 1 -me_method umh -me_range 16 -subq 7 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -qcomp 0.6 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 384k -ar 48000</params>
+    <params>-f mp4 -r 23.976 -vcodec libx264 -s 1280x720 -b:v 3000k -aspect 16:9 -bt 256k -acodec libfaac -ab 384k -ar 48000</params>
     <extension>mp4</extension>
     <category>PS3</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </ps3720p>
   <ps3720pfs>
     <label>PS3 720p Fullscreen</label>
-    <params>-f mp4 -r 23.976 -vcodec libx264 -vpre medium -s 1280x720 -b 3000k -aspect 4:3 -flags +loop -cmp +chroma -deblockalpha 0 -deblockbeta 0  -maxrate 3500k -bufsize 4M -bt 256k -refs 1 -bf 3 -coder 1 -me_method umh -me_range 16 -subq 7 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -qcomp 0.6 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 384k -ar 48000</params>
+    <params>-f mp4 -r 23.976 -vcodec libx264 -s 1280x720 -b:v 3000k -aspect 4:3 -bt 256k -acodec libfaac -ab 384k -ar 48000</params>
     <extension>mp4</extension>
     <category>PS3</category>
-    <codecs>libx264,libfaac</codecs>
+    <codecs>h264,aac</codecs>
   </ps3720pfs>
   <image1sec>
     <label>Extract JPEG images, one every 1 second</label>
@@ -674,36 +674,49 @@
     <params>-s 480x320 -vcodec mpeg4 -acodec libfaac -ac 1 -ar 16000 -r 13 -ab 32000 -aspect 3:2</params>
     <extension>mp4</extension>
     <category>Mobile Phones</category>
-    <codecs>mpeg4,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </android1>
  <android2>
     <label>Google Android compatible video. Video bitrate: 480 kb/s</label>
-    <params>-s 480x320 -vcodec mpeg4 -b 480k -acodec libfaac -ac 1 -ar 16000 -r 13 -ab 32000 -aspect 3:2</params>
+    <params>-s 480x320 -vcodec mpeg4 -b:v 480k -acodec libfaac -ac 1 -ar 16000 -r 13 -ab 32000 -aspect 3:2</params>
     <extension>mp4</extension>
     <category>Mobile Phones</category>
-    <codecs>mpeg4,libfaac</codecs>
+    <codecs>mpeg4,aac</codecs>
   </android2>
- <iphone1>
+  <iphone1>
     <label>Iphone</label>
-    <params>-f mp4 -s 432x320 -aspect 432:320 -acodec aac -async
-    4800 -dts_delta_threshold 1 -vcodec xvid -qscale 7 </params>
+    <params>-f mp4 -s 432x324 -aspect 4:3 -acodec libfaac -async 4800 -dts_delta_threshold 1 -vcodec libxvid -q:v 7</params>
     <extension>mp4</extension>
     <category>Mobile Phones</category>
-    <codecs>xvid,aac,mp4</codecs>
+    <codecs>mpeg4,aac</codecs>
   </iphone1>
+  <nphone1>
+    <label>Asha</label>
+    <params>-f 3gp -vf crop=4/3*in_h:in_h -s 320x240 -aspect 4:3 -acodec libfaac -ar 44100 -vcodec mpeg4 -q:v 7</params>
+    <extension>3gp</extension>
+    <category>Mobile Phones</category>
+    <codecs>mpeg4,aac</codecs>
+  </nphone1>
+  <nphone2>
+    <label>Asha 2Pass</label>
+    <params>-f 3gp -vf crop=4/3*in_h:in_h -s 320x240 -aspect 4:3 -acodec libfaac -ab 64k -ar 44100 -vcodec mpeg4 -b:v 400k</params>
+    <extension>3gp</extension>
+    <category>Mobile Phones</category>
+    <codecs>mpeg4,aac</codecs>
+  </nphone2>
   <CowoniAudio7AVIbeta1>
     <label>Cowon iAudio 7 AVI beta 1</label>
-    <params>-f avi -g 1 -b 256k -r 12 -async 2 -vf scale=160:120 -vtag XVID -vcodec libxvid -ab 128k -ar 44100 -ac 2 -acodec libmp3lame </params>
+    <params>-f avi -g 1 -b:v 256k -r 12 -async 2 -s 160x120 -vtag xvid -vcodec libxvid -ab 128k -ar 44100 -ac 2 -acodec libmp3lame</params>
     <extension>avi</extension>
     <category>Portable Media Players</category>
-    <codecs>libxvid,libmp3lame</codecs>
+    <codecs>mpeg4,mp3</codecs>
   </CowoniAudio7AVIbeta1>
   <CowoniAudio7AVIbeta2>
     <label>Cowon iAudio 7 AVI beta 2</label>
-    <params>-f avi -g 1 -b 384k -vcodec libxvid -vtag XVID -ab 128k -ar 44100 -ac 2 -acodec libmp3lame -vf scale=160:128,aspect=4:3  -r 15 </params>
+    <params>-f avi -g 1 -b:v 384k -vcodec libxvid -vtag xvid -ab 128k -ar 44100 -ac 2 -acodec libmp3lame -s 160x128 -aspect 4:3 -r 15</params>
     <extension>avi</extension>
     <category>Portable Media Players</category>
-    <codecs>libxvid,libmp3lame</codecs>
+    <codecs>mpeg4,mp3</codecs>
   </CowoniAudio7AVIbeta2>
 
 
diff -3ur a/share/sinthgunt.glade b/share/sinthgunt.glade
--- a/share/sinthgunt.glade	2013-02-14 23:15:54.000000000 +0400
+++ b/share/sinthgunt.glade	2017-02-20 16:38:40.000000000 +0300
@@ -45,20 +45,6 @@
                                 </child>
                               </widget>
                             </child>
-                            <child>
-                              <widget class="GtkImageMenuItem" id="menuopenyoutube">
-                                <property name="visible">True</property>
-                                <property name="label" translatable="yes">_Online video</property>
-                                <property name="use_underline">True</property>
-                                <signal name="activate" handler="on_menuopenyoutube_activate"/>
-                                <child internal-child="image">
-                                  <widget class="GtkImage" id="menu-item-image2">
-                                    <property name="visible">True</property>
-                                    <property name="stock">gtk-network</property>
-                                  </widget>
-                                </child>
-                              </widget>
-                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -229,17 +215,6 @@
               </widget>
               <packing>
                 <property name="homogeneous">True</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkToolButton" id="toolbaropenyoutube">
-                <property name="visible">True</property>
-                <property name="label" translatable="yes">Open online video</property>
-                <property name="stock_id">gtk-network</property>
-                <signal name="clicked" handler="on_toolbaropenyoutube_clicked"/>
-              </widget>
-              <packing>
-                <property name="homogeneous">True</property>
               </packing>
             </child>
             <child>
diff -3ur a/sinthgunt b/sinthgunt
--- a/sinthgunt	2010-11-14 15:02:41.000000000 +0300
+++ b/sinthgunt	2017-02-20 16:38:40.000000000 +0300
@@ -1,4 +1,5 @@
 #!/usr/bin/python
+# -*- coding: utf-8 -*-
 
 """
 sinthgunt wrapper script.
